package com.onstar.cn.vehicle.entity;

import java.io.Serializable;

/**
 * @author Jerome Lin
 * @2011-1-22下午12:36:26
 */
public enum ErrorEnum implements Serializable {
	
	//ONS-100 – 199: user error; user action is required
	
	ONS_101("ONS-101"),  //User session expired.
	ONS_102("ONS-102"),
	ONS_103("ONS-103"),
	ONS_104("ONS-104"),  //User exceeded service execution limit
	ONS_105("ONS-105"), // User input is not valid.
	ONS_106("ONS-106"), //Invalid or unsupported Vehicle selection.
	ONS_107("ONS-107"), //Invalid account
	ONS_108("ONS-108"), //Unable to retrieve subscriptions
	ONS_110("ONS-110"), //Dealer information is not available.
	ONS_111("ONS-111"),
	ONS_112("ONS-112"),
	ONS_113("ONS-113"),
	ONS_114("ONS-114"),
	
	//ONS-200 – 399: vehicle errors
	ONS_201("ONS-201"),  //Vehicle connection lost
	ONS_210("ONS-210"),  //Unable to connect to vehicle 
	ONS_211("ONS-211"), //Vehicle command cannot be executed due to invalid vehicle state
	ONS_212("ONS-212"), //Unable to connect to vehicle(Invalid information) 
	ONS_213("ONS-213"), //Unable to get data (Partial read)
	ONS_214("ONS-214"), //Unable to get data
	ONS_215("ONS-215"), //Unable to execute request
	ONS_216("ONS-216"),  //Unable to establish packet session to the vehicle
	ONS_217("ONS-217"),  //Unable to initiate request through SMS
	ONS_218("ONS-218"),  //Vehicle Request Type Not Supported
	
	ONS_219("ONS-219"),
	ONS_220("ONS-220"),
	ONS_230("ONS-230"),
	ONS_231("ONS-231"),
	ONS_232("ONS-232"),
	ONS_233("ONS-233"),
	ONS_234("ONS-234"),
	ONS_300("ONS-300"),
	ONS_301("ONS-301"),
	
	VEHICLE_EXCEPTION("vehicle_exception"),//runtime exception happen , record as that error
	
	//ONS-800 - 899: data error – user calls support
	ONS_801("ONS-801"), // Cannot save data.
	ONS_802("ONS-802"), //Invalid input data. Try again with correct data 
	ONS_803("ONS-803"),  //Required data not found.
	ONS_804("ONS-804"),  //Duplicate subscriptions found. Cannot save data
	ONS_805("ONS-805"),
	ONS_806("ONS-806"),
	
	//ONS-900 - 999: sys error – user calls support
	ONS_900("ONS-900"),  //Unknown System Error
	ONS_901("ONS-901"),  //Service not available
	ONS_902("ONS-902"),  //Unable to send notification
	ONS_903("ONS-903"),  //Unable to retrieve subscriptions
	ONS_910("ONS-910"),  //Feature not supported
	
	//HTTP error
	H401("401"),  //Authentication failed
	H403("403"),
	
	//SOMP-301-399: user error 
	SOMP_301("SOMP-301"),  //User login failure
	SOMP_302("SOMP-302"),  //User is disabled
	SOMP_303("SOMP-303"),  //Device is not registered
	SOMP_304("SOMP-304"),  //Device is during the registration process
	SOMP_305("SOMP-305"),  //User is not opt-in
	SOMP_306("SOMP-306"),  //No usable accountNum found
	SOMP_307("SOMP-307"),  //Device is not registered
	SOMP_308("SOMP-308"),  //Device is during the registration process
	SOMP_309("SOMP-309"),  //User is not opt-in
	SOMP_310("SOMP-310"),  //No usable accountNum found
	SOMP_311("SOMP-311"),
	SOMP_312("SOMP-312"),
	SOMP_313("SOMP-313"),
	SOMP_314("SOMP-314"),
	SOMP_315("SOMP-315"),
	SOMP_316("SOMP-316"),
	SOMP_317("SOMP-317"),
	SOMP_318("SOMP-318"),
	SOMP_319("SOMP-319"),
	SOMP_320("SOMP-320"),
	SOMP_321("SOMP-321"),
	SOMP_322("SOMP-322"),
	SOMP_323("SOMP-323"),
	SOMP_324("SOMP-324"),
	SOMP_325("SOMP-325"),

	
	SOMP_401("SOMP-401"),
	SOMP_402("SOMP-402"),
	SOMP_403("SOMP-403"),
	SOMP_404("SOMP-404"),
	SOMP_405("SOMP-405"),
	
	SOMP_501("SOMP-501"),
	SOMP_502("SOMP-502"),
	SOMP_503("SOMP-503"),
	
	SOMP_601("SOMP-601"),
	SOMP_602("SOMP-602"),
	SOMP_603("SOMP-603"),
	SOMP_604("SOMP-604"),
	SOMP_605("SOMP-605"),
	SOMP_606("SOMP-606"),
	
	SOMP_701("MAG-701"),
	SOMP_702("MAG-702"),
	
	
	SOMP_901("SOMP-901"),  //手机网络有问题(手机不能上网)
	SOMP_902("SOMP-902"),  //请求连接超时或读取超时 
	SOMP_903("SOMP-903"),  //返回的xml与xsd不符合
	SOMP_904("SOMP-904"),  //其他(比如，请求被服务器拒绝等) 
	SOMP_905("SOMP-905"),  // 对samalToken失败的处理:
	SOMP_906("SOMP-906"),  //当refresh data 10分钟超时和 remote control 3分钟超时
	SOMP_907("SOMP-907"),  //返回的ServiceResponse 中的requestStatus 字段值是failure
	
	// join me
	C400_1("C400_1"), //Missing required parameter or input parameter name is not supported by the API
	C401_1("C401_1"), //Authentication failed
	C401_2("C401_2"), //Access Token Expired
	C401_3("C401_3"), //Access token invalid due to password change
	C401_4("C401_4"), //Authorization failed
	C401_5("C401_5"), //Access token invalid due to password expired
	C403_2("C403_2"), //Client ID validation failed
	C402_6("C402_6"), //Exceeds allowable attempts- user locked
	C404_4("C404_4"), //User not found
	C423_1("C423_1"), //Access token invalid due to account locked
	C500_1("C500_1"), //Failed to process the request, server-side error
	
	
	SOMP_326("SOMP-326"), //您已经开通了手机应用
	SOMP_327("SOMP-327"), //GAA没有手机和邮箱
	SOMP_328("SOMP-328"), //操作类型无效
	SOMP_329("SOMP-329"), //验证码无效
	SOMP_330("SOMP-330"), //VIN 或 GovernmentId 为空
	SOMP_331("SOMP-331"), //您的车辆存在多种身份，请输入证件号进行升级
	SOMP_333("SOMP-333"), //登录系统更新
	
	
	SB021_MSG001("SB021_MSG001"),//User Name or password is incorrect, please try it again. Tips: System will lock 10 minutes if you type wrong password for 5 times
	SB021_MSG000("SB021_MSG000"),//可以升级为车主
	SB021_MSG004("SB021_MSG004"),//验证码输入错误
	SB021_MSG006("SB021_MSG006"), //register faild
	SB021_MSG007("SB021_MSG007"), 
	SB021_MSG008("SB021_MSG008"), 
	SB021_MSG010("SB021_MSG010"), //register success
	SB021_MSG011("SB021_MSG011"), //register success
	SB021_MSG012("SB021_MSG012"),
	SB021_MSG013("SB021_MSG013"),
	SB021_MSG014("SB021_MSG014"),
	SB021_MSG019("SB021_MSG019"),
	SB021_MSG020("SB021_MSG020"),
	SB021_MSG023("SB021_MSG023"),
	SB021_MSG024("SB021_MSG024"),
	SB021_MSG022("SB021_MSG022"),//Your information is wrong, please call 4008201188 ask advisor for help
	SB021_MSG028("SB021_MSG028"),//password_expired
	SB021_MSG026("SB021_MSG026"),//Password cannot be the same as username
	SB021_MSG031("SB021_MSG031"),//This password is not properly formatted，don’t support special character
	SB021_MSG032("SB021_MSG032"),//You have typed wrong password for 5 times, system will lock 10 minutes, please try it later.
	SB021_MSG033("SB021_MSG033"),//Check code success
	SB021_28("SB021-28"),
	
	
	SB022_MSG003("SB022_MSG003"),//Passwords are not the same
	SB022_MSG008("SB022_MSG008"),//change email success
	SB022_MSG009("SB022_MSG009"),//change mobile success
	SB022_MSG010("SB022_MSG010"),//change password success
	SB022_MSG011("SB022_MSG011"),//change email failed
	SB022_MSG012("SB022_MSG012"),//change mobile failed
	SB022_MSG013("SB022_MSG013"),//change password failed
	SB022_MSG015("SB022_MSG015"),//Failed to send dynamic code
	SB022_MSG016("SB022_MSG016"),//This phone number is not correct
	SB022_MSG017("SB022_MSG017"),//System is upgrading, please try it later[系统正在维护升级，请稍候再试]
	SBMAG_MSG001("SBMAG_MSG001"),//无法获取服务，就是从BRM未拿到数据

	
	SB024_MSG001("SB024_MSG001"),//feedback success
	SB024_MSG002("SB024_MSG002"),//feedback failed
	
	//prepay card
	SB027_MSG001("SB027_MSG001"),//卡号格式有误
	SB027_MSG002("SB027_MSG002"),//卡号或密玛错误
	SB027_MSG003("SB027_MSG003"),//车辆识别码格式错误
	SB027_MSG004("SB027_MSG004"),//不能为空
	SB027_MSG005("SB027_MSG005"),//该车辆未注册，请通过蓝色按钮进行注册
	SB027_MSG006("SB027_MSG006"),//恭喜您预付卡激活成功
	SB027_MSG007("SB027_MSG007"),//预付卡激活失败
	SB027_MSG008("SB027_MSG008"),//无历史纪录
	SB027_MSG009("SB027_MSG009"),//无历史纪录
	SB027_MSG020("SB027_MSG020"),//无历史纪录
	SB006_MSG002("SB006_MSG002"),//删除围栏失败
	
	MAG_503("MAG-503"),//强制升级
	L7_001("L7_001"),//layer7 错误 需要转换error msg
	L7_201("L7_201"),
	L7_202("L7_202"),
	L7_203("L7_203"),
	L7_204("L7_204"),
	L7_205("L7_205"),
	L7_206("L7_206"),
	L7_207("L7_207"),
	
	L7_301("L7_301"),
	L7_302("L7_302"),
	L7_303("L7_303"),
	L7_304("L7_304"),
	L7_305("L7_305"),
	L7_306("L7_306"),
	E9004("E9004"),
	E9001("E9001"),
	E2011("E2011"),
	E0000("E0000");


	private String value;
	
	ErrorEnum(String value){
		this.value = value;
	}
	
	public String getStringValue() {
        return value;
    }
	
	public static ErrorEnum fromValue(String v) {
		for (ErrorEnum c : ErrorEnum.values()) {
			if (c.value.equals(v)) {
				return c;
			}
		}
		return null;
	}
	
}
